Use const operand for ARM syscall implementation#565
Use const operand for ARM syscall implementation#565Ioan-Cristian wants to merge 6 commits intotock:masterfrom
Conversation
170b56c to
79530b5
Compare
|
Note that this requires an update of the Rust version. @jrvanwhy (and others) are any significant implications for downstream users)? |
I discussed this with Lawrence, it sounds like there would be minimal impact (i.e. they would add Longer term, we may want to have a stricter MSRV policy, but this PR isn't an issue. |
|
Are the CI failures related to this change? |
|
Yes, they seem to fail on this branch, but not on master. I am not familiar with the test environment, so I don't know why they fail. |
|
The error message makes it looks like the toolchain is catching something that would be UB -- a panic unwinding across the syscall boundary. However, Regardless, the CI failure is almost certainly due to the toolchain update. I don't have time to debug further for at least a few more days, sadly. |
|
It seems the mechanism we use to catch unwinding upcalls is unreliable: rust-lang/rust#123231. I'm still reading through the thread; I don't have time to finish reading it (much less understand it) tonight. I suspect that this is defined behavior, but an abort is definitely not how we want this to be handled. If so, then the unit test failure is correct: our code is not handling an unwinding upcall in the manner it is supposed to. On another note, |
|
I've done some more reading. The good news: this is not and never was UB. Further, catching the unwind wasn't necessary for safety anyway -- code that tries to unwind across an The bad news: That behavior is not spec'd yet, so we can't rely on it. In that respect, the unit test failure is correct: our code does not reliably work. The only proper fix I see is to require the caller to inject a For this PR, lets just delete the |
`asm_const` feature has been stabilized in Rust 1.82. Using const operands for inline assembly eliminates a lot of the duplicated code in the ARM syscall implementation. This commit has been tested by running a simple application that periodically blinks and writes a message on Raspberry Pi Pico.
79530b5 to
7576183
Compare
|
I commented out the test explaining why it was removed and that it should be readded when Rust is updated to 1.84. |
jrvanwhy
left a comment
There was a problem hiding this comment.
Oh, CI is still failing. This time it appears to just be due to new lints.
|
Do you think I should create a separate PR to fix the lint checks? |
|
IMO same PR in a standalone commit would be fine. Alternatively you could do a standalone PR for the Rust update which would include removing the test and the lint fixes, and this PR could just be the asm_const change and nothing else. |
|
At this point 1.84 is out — should this PR just bump directly to 1.84 now? |
The toolchain bump from 1.79 to 1.82 introduced a new clippy lint regarding transmutes. This commit fixes the emitted lint warnings.
Added a new commit that attempts to fix clippy lints. |
|
After two more version upgrades and some clippy/format fixes, everything passes now. |
| # This must be kept in sync with rust-toolchain.toml; please see that file for | ||
| # more information. | ||
| rust-version = "1.77" | ||
| rust-version = "1.87" |
There was a problem hiding this comment.
This should be split out into a separate PR
There was a problem hiding this comment.
+1. Looking at the individual commits, it seems like there are 3 separate PRs here (Rust update, const ASM, and something about a heap setup?).
The Rust update is the largest one because of all the clippy-induced refactorings.
|
Created a separate PR for Rust bump version. I will reopen this PR once that gets merged. |
asm_constfeature has been stabilized in Rust 1.82. Using const operands for inline assembly eliminates a lot of the duplicated code in the ARM syscall implementation.This commit has been tested by running a simple application that periodically blinks and writes a message on Raspberry Pi Pico.